Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(aws-sdk): calc propagation fields count before context inject #738

Merged
merged 6 commits into from
Jan 14, 2022

Conversation

YanivD
Copy link
Member

@YanivD YanivD commented Nov 14, 2021

Which problem is this PR solving?

Background: As described here, SQS/SNS services limited up to 10 message metadata attributes.

The instrumentation is checking if there are enough available attributes before adding more metadata attributes.

Before this pr, it ignored how many fields are going be added by applied propagators.
After this pr, it will check how many fields are going be added, to make sure not setting more than 10 message metadata attributes.

@@ -64,7 +64,7 @@ export const injectPropagationContext = (
attributesMap?: SQS.MessageBodyAttributeMap | SNS.MessageAttributeMap
): SQS.MessageBodyAttributeMap | SNS.MessageAttributeMap => {
const attributes = attributesMap ?? {};
if (Object.keys(attributes).length < MAX_MESSAGE_ATTRIBUTES) {
if (Object.keys(attributes).length + propagation.fields().length <= MAX_MESSAGE_ATTRIBUTES) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please add a simple unit test for that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blumamir blumamir changed the title chore(aws-sdk): calc propagation fields count before context inject fix(aws-sdk): calc propagation fields count before context inject Nov 14, 2021
@YanivD YanivD requested a review from blumamir November 15, 2021 08:41
@YanivD YanivD marked this pull request as draft November 15, 2021 14:01
@YanivD YanivD marked this pull request as ready for review January 10, 2022 10:47
@codecov
Copy link

codecov bot commented Jan 10, 2022

Codecov Report

Merging #738 (65ada8b) into main (fcdc14e) will not change coverage.
The diff coverage is n/a.

❗ Current head 65ada8b differs from pull request most recent head 68bc917. Consider uploading reports for the commit 68bc917 to get more accurate results

@@           Coverage Diff           @@
##             main     #738   +/-   ##
=======================================
  Coverage   94.90%   94.90%           
=======================================
  Files          13       13           
  Lines         707      707           
  Branches      142      142           
=======================================
  Hits          671      671           
  Misses         36       36           

@blumamir blumamir merged commit 033cc1f into open-telemetry:main Jan 14, 2022
@dyladan dyladan mentioned this pull request Feb 28, 2022
@dyladan dyladan mentioned this pull request Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants